import request from '@/utils/request'

/**
 * 分页获取
 */
export function getCouponByPage(params, pageNum, pageSize, token) {
    return request({
        url: '/coupon/list/page',
        method: 'get',
        params: {
            ...params,
            pageNum,
            pageSize,
        },
        headers: {
            'token': token
        }
    })
}

/**
 * 保存
 */
export function addOrUpdateCoupon(coupon, token) {
    return request({
        url: '/coupon/addOrUpdate',
        method: 'post',
        data: coupon,
        headers: {
            'token': token
        }
    })
}

/**
 * 优惠卷详情
 */
export function getCouponDetail(id, token) {
    return request({
        url: '/coupon/getCouponDetail/' + id,
        method: 'get',
        headers: {
            'token': token
        }
    })
}

/**
 * 删除优惠卷信息
 */
export function delCouponById(id, token) {
    return request({
        url: '/coupon/delCouponById/' + id,
        method: 'post',
        headers: {
            'token': token
        }
    })
}